- stationary_shop_management.cpp
- project /
1 #include<stdio.h>
2 #include<conio.h>
3 #include<string.h>
4 #include <windows.h>
5
6 struct book
7 {char buk[20][20]={"schand phy",
8 "bs grewal",
9 "let us c"};
10 int schandphy=20,bsgrewal=20,letusc=20;
11 }k;
12 struct si
13 {int pencil=20,pen=20,scissors=20;
14 }i;
15
16 void renwe()
17 {int w,d,b,a,u,v,t;
18
19 if(i.pen<5)
20 { printf("\nadd more pens");
21 printf("\nwant to add pens now enter(1) or (0)");
22 scanf("%d",&w);
23 if (w==1)
24 {printf("\nhow many pens you want to add");
25 scanf("%d",&d);
26 i.pen=i.pen+d;
27 printf("\npens are added & now total pens are %d",i.pen);}
28 else
29 printf("\nremaining pens are %d",i.pen);}
30
31 if(i.pencil<5)
32 { printf("\nadd more pencil");
33 printf("\nwant to add pencil now enter(1) or (0)");
34 scanf("%d",&w);
35 if (w==1)
36 {printf("\nhow many pencil you want to add");
37 scanf("%d",&b);
38 i.pencil=i.pencil+b;
39 printf("\npencils are added & now total pencils are %d",i.pencil);}
40 else
41 printf("\nremaining pencil are %d",i.pencil);}
42
43 if(i.scissors<5)
44 { printf("\nadd more scissors");
45 printf("\nwant to add scissors now enter(1) or (0)");
46 scanf("%d",&w);
47 if (w==1)
48 {printf("\nhow many scissors you want to add");
49 scanf("%d",&a);
50 i.scissors=i.scissors+a;
51 printf("\nscissors are added & now total scissors are %d",i.scissors);}
52 else
53 printf("\nremaining scissors are %d",i.scissors);}
54
55
56 if(k.schandphy<5)
57 { printf("\nadd more physics book");
58 printf("\nwant to add physics book now enter(1) or (0)");
59 scanf("%d",&w);
60 if (w==1)
61 {printf("\nhow many physics book you want to add");
62 scanf("%d",&u);
63 k.schandphy=k.schandphy+u;
64 printf("\n schand physics book are added & now total physics books are %d",k.schandphy);}
65 else
66 printf("\nremaining schand physics book are %d",k.schandphy);}
67
68 if(k.bsgrewal<5)
69 { printf("\nadd more maths book");
70 printf("\nwant to add maths book now enter(1) or (0)");
71 scanf("%d",&w);
72 if (w==1)
73 {printf("\nhow many maths book you want to add");
74 scanf("%d",&v);
75 k.bsgrewal=k.bsgrewal+v;
76 printf(" \nBS Grewal maths books are added & now total maths book are %d",k.bsgrewal);}
77 else
78 printf("\nremaining BS grewal book are %d",k.bsgrewal);}
79
80 if(k.letusc<5)
81 { printf("\nadd more computer book");
82 printf("\nwant to add computer book now enter(1) or (0)");
83 scanf("%d",&w);
84 if (w==1)
85 {printf("\nhow many cse book you want to add");
86 scanf("%d",&t);
87 k.letusc=k.letusc+t;
88 printf("\n Let us c books are added & now total CSE books are %d",k.letusc);}
89 else
90 printf("\nremaining cse book are %d",k.letusc);}
91
92 printf("\nremaining items are\n");
93 printf("\n pens%d",i.pen);
94 printf("\n pencils%d",i.pencil);
95 printf("\n scissors%d",i.scissors);
96 printf("\n Schand physics book%d",k.schandphy);
97 printf("\n maths BS grewal book%d",k.bsgrewal);
98 printf("\n CSE Let us c book%d",k.letusc);
99
100
101
102
103 }
104
105
106 main()
107 {int b,a,q,r,e,f,g,t,m,pay,on,old,gft,yn,ny;
108 long int acc,accn;
109 float amount,disc;
110 p: amount=0;b=0;q=0;r=0;e=0;f=0;g=0;disc=0,pay=0;
111 char c[20]={"csepbl"},s[20];
112 system("cls");
113 z: printf("\nWelcome to Stationary Shop Management System\n");
114 printf("\nEnter Your Choice as '1' for book and '0' for other stationary items");
115 scanf("%d",&a);
116 system("cls");
117 if (a==1)
118 {int x;
119 printf("\nchoose the book as\n ");
120 printf("\n\n(1)schand physics-(Rs 200 each) ");
121 printf("\n\n(2)bs grewal maths-(Rs 400 each) ");
122 printf("\n\n(3)let us c-(Rs 150 each) ");
123 printf("\n\nyou will get discount of 25 percent if you purchase more than Rs1000 or if you purchase more than 5 items\n");
124 scanf("%d",&x);
125 switch(x)
126 {case 1:{system("cls");printf("\nschand physics (2014 new publication)");
127 printf("\n\nenter the quantity ");
128 scanf("%d",&b);
129 if (b>k.schandphy)
130 printf("\ninsufficient amount\n");
131 else
132 {amount=amount+200*b;
133 k.schandphy=k.schandphy-b;}
134 printf("\nwant to purchase more enter 1 or 0 ");
135 scanf("%d",&t);
136 if (t==1)
137 goto z;
138 else if (t==0)
139 goto u;
140 else
141 printf("invalid input ");
142 break;}
143 case 2:{system("cls");printf("\nbs grewal maths (2014 new publication) ");
144 printf("\n\nenter the quantity ");
145 scanf("%d",&q);
146 if (q>k.bsgrewal)
147 printf("\ninsufficient amount\n ");
148 else
149 {amount=amount+400*q;
150 k.bsgrewal=k.bsgrewal-q;}
151 printf("\nwant to purchase more enter 1 or 0 ");
152 scanf("%d",&t);
153 if (t==1)
154 goto z;
155 else if (t==0)
156 goto u;
157 else
158 printf("invalid input ");
159 break;}
160 case 3:{system("cls");printf("\nLet us C by yashvant kanetkar(computer science 2014 new publication) ");
161 printf("\n\nenter the quantity ");
162 scanf("%d",&r);
163 if (r>k.letusc)
164 printf("\ninsufficient amount\n ");
165 else
166 {amount=amount+150*r;
167 k.letusc=k.letusc-r;}
168 printf("\nwant to purchase more enter 1 or 0 ");
169 scanf("%d",&t);
170 if (t==1)
171 goto z;
172 else if (t==0)
173 goto u;
174 else
175 printf("invalid input ");
176 break;}
177 default:{
178 printf("\n invalid input");
179 }
180
181
182 }
183 }
184 else if (a==0)
185 {int y;
186 printf("\nchoose your choice as \n ");
187 printf("\n\n(4)pencils-(Rs 10 each) ");
188 printf("\n\n(5)pens-(Rs 30 each) ");
189 printf("\n\n(6)scissors-(Rs 50 each) ");
190 printf("\n\nyou will get discount of 25 percent if you purchase more than Rs1000 or if you purchase more than 10 items\n");
191 scanf("%d",&y);
192 switch(y)
193 {case 4:{system("cls");printf("\npencils(HB) ");
194 printf("\nenter the quantity ");
195 scanf("%d",&e);
196 if(e>i.pencil)
197 printf("\ninsufficient amount\n ");
198 else
199 {amount=amount+10*e;
200 i.pencil=i.pencil-e;
201 }
202 printf("\nwant to purchase more enter 1 or 0 ");
203 scanf("%d",&t);
204 if (t==1)
205 goto z;
206 else if (t==0)
207 goto u;
208 else
209 printf("invalid input ");
210 break;}
211 case 5:{system("cls");printf("\npens");
212 printf("\n\nenter the quantity ");
213 scanf("%d",&f);
214 if(f>i.pen)
215 printf("\ninsufficient amount\n ");
216 else
217 {amount=amount+30*f;
218 i.pen=i.pen-f;
219 }
220 printf("\nwant to purchase more enter 1 or 0 ");
221 scanf("%d",&t);
222 if (t==1)
223 goto z;
224 else if (t==0)
225 goto u;
226 else
227 printf("invalid input");
228 break;
229 }
230 case 6:{system("cls");printf("\nscissors ");
231 printf("\n\nenter the quantity ");
232 scanf("%d",&g);
233 if(g>i.scissors)
234 printf("\ninsufficient amount\n");
235 else
236 {amount=amount+50*g;
237 i.scissors=i.scissors-g;
238 }
239 printf("\nwant to purchase more enter 1 or 0 ");
240 scanf("%d",&t);
241 if (t==1)
242 goto z;
243 else if (t==0)
244 goto u;
245 else
246 printf("invalid input");
247 break;
248 default:{
249 printf("\n invalid input");
250 }
251 }
252 }
253 }
254 else
255 printf("invalid input");
256 system("cls");
257 u:printf("\nyou bought");
258 printf("\n\nphysics schand-%d",b);
259 printf("\n\nbs grewal-%d",q);
260 printf("\n\nlet us c-%d",r);
261 printf("\n\npencils-%d",e);
262 printf("\n\npens-%d",f);
263 printf("\n\nscissors-%d",g);
264 printf("\n\npress enter\n");getch();
265 if ((b+q+r)>=5||(e+f+g)>=10||amount>=1000)
266 {disc=amount/4;
267 }
268 else
269 disc=0;
270 system("cls");
271 pay=(amount-disc);old=((amount-disc)-(amount/5));
272 printf("\n\nare u an old customer press (1) or new customer (0)\n ");
273 scanf("%d",&on);
274 if (on==1)
275 {printf("\nyour total amount is:-%f",amount);
276 printf("\n\n you can pay:- %d",old);}
277 else
278 {printf("\nyour total amount is:-%f",amount);
279 printf("\n\n you can pay:- %d",pay);}
280
281 printf("\n\nnotification for shopkeeper.....please enter the code ");
282 scanf("%s",&s);
283 if(strcmp(s,c)==0)
284 renwe();
285 else
286 printf("\n\ninvalid input of code");
287
288
289 getch();
290 }